home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: 15 Aug 1997
- // Author: rh
- //
- // Description:
- // Add a render attribute to the particle shape. The attribute
- // description is passed in as attrInfo. The description comes
- // from the render subclasses. It describes the name, type, min,
- // max values, and what type of ui to build.
- //
-
-
- global proc dynAddParticleAttr( string $nodeName, string $attrInfo )
- {
- string $cmd;
- string $tokenAry[];
- int $tokenCnt;
- int $makeKeyable = 1;
-
- tokenize( $attrInfo, ":", $tokenAry );
- $tokenCnt = size( $tokenAry );
-
-
- // Adding a string attr is a special case because we cannot use the
- // default value (-dv) command. We need to set the attribute
- // seperately.
- //
- if (($tokenCnt >= 3) && ($tokenAry[2] == "textfield"))
- {
- $cmd = "addAttr -is true -dt \"string\" -ln \"" +$tokenAry[0]+ "\" " +$nodeName+";";
- evalEcho $cmd;
- $cmd = "setAttr -type \"string\" " + $nodeName+"."+$tokenAry[0] + " \"" + $tokenAry[1] + "\";";
- evalEcho $cmd;
- }
- else if (($tokenCnt >= 3) && ($tokenAry[2] == "toggleBtn"))
- {
- $cmd = "addAttr -is true -ln \""+$tokenAry[0]+"\" -at bool -dv "+$tokenAry[1]+" " +$nodeName+";";
- evalEcho $cmd;
- }
- else if (($tokenCnt >= 3) && ($tokenAry[2] == "intSlider"))
- {
- $cmd = "addAttr -is true -ln \""+$tokenAry[0]+"\" -at long -min "+$tokenAry[3]
- +" -max "+$tokenAry[4]+" -dv "+$tokenAry[1]+" " +$nodeName+";";
- evalEcho $cmd;
- }
- else if (($tokenCnt >= 3) && ($tokenAry[2] == "floatSlider"))
- {
- $cmd = "addAttr -is true -ln \""+$tokenAry[0]+"\" -at \"float\" -min "+$tokenAry[3]
- +" -max "+$tokenAry[4]+" -dv "+$tokenAry[1]+" " +$nodeName+";";
- evalEcho $cmd;
- }
- else if (($tokenCnt >= 3) && ($tokenAry[2] == "intField"))
- {
- $cmd = "addAttr -is true -ln \""+$tokenAry[0]+"\" -at long -dv "+$tokenAry[1]+" " +$nodeName+";";
- evalEcho $cmd;
- }
- else if (($tokenCnt >= 3) && ($tokenAry[2] == "vector"))
- {
- $cmd = "addAttr -is true -ln \""+$tokenAry[0]+"\" -dt double3 " +$nodeName+";";
- evalEcho $cmd;
- eval( "setAttr -type double3 "+$nodeName+"."+$tokenAry[0]+" 0 0 0;" );
- $makeKeyable = 0;
- }
- else if (($tokenCnt >= 3) && ($tokenAry[2] == "vectorArray"))
- {
- $makeKeyable = 0;
- $cmd = "addAttr -ln "+$tokenAry[0]+" -dt vectorArray "+$nodeName+";";
- evalEcho $cmd;
-
- // Add the initial state attribute.
- //
- $cmd = "addAttr -ln "+$tokenAry[0]+"0 -dt vectorArray "+$nodeName+";";
- evalEcho $cmd;
- }
- else if (($tokenCnt >= 3) && ($tokenAry[2] == "intArray"))
- {
- $makeKeyable = 0;
- $cmd = "addAttr -ln "+$tokenAry[0]+" -dt Int32Array "+$nodeName+";";
- evalEcho $cmd;
-
- // Add the initial state attribute.
- //
- $cmd = "addAttr -ln "+$tokenAry[0]+"0 -dt Int32Array "+$nodeName+";";
- evalEcho $cmd;
- }
- else if (($tokenCnt >= 3) && ($tokenAry[2] == "floatArray"))
- {
- $makeKeyable = 0;
- $cmd = "addAttr -ln "+$tokenAry[0]+" -dt doubleArray "+$nodeName+";";
- evalEcho $cmd;
-
- // Add the initial state attribute.
- //
- $cmd = "addAttr -ln "+$tokenAry[0]+"0 -dt doubleArray "+$nodeName+";";
- evalEcho $cmd;
- }
- else
- {
- $cmd = "addAttr -is true -ln \"" +$tokenAry[0]+ "\" -dv " +$tokenAry[1]+ " " +$nodeName+";";
- evalEcho $cmd;
- }
-
-
- if ($makeKeyable)
- {
- setAttr -keyable true ($nodeName+"."+$tokenAry[0]);
- }
-
-
- } // dynAddParticleAttr //
-